package com.kylin.common.weixin.mp.bean.message;

import com.alibaba.fastjson2.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 文本消息
 * @author wuhao
 * @version 1.0 - 2023/6/6
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TextMessage extends BaseMessage{
    /** 文本内容 */
    private String content;

    /**
     * 转换文字回复
     * @return
     * @author wuhao
     * @version 1.0.0 - 2023/6/6
     */
    public JSONObject toJSON() {
        JSONObject json = new JSONObject();
        json.put("ToUserName",this.getToUserName());
        json.put("FromUserName",this.getFromUserName());
        json.put("CreateTime", System.currentTimeMillis());
        json.put("MsgType","text");
        json.put("Content",this.content);
        return json;
    }
}
